<?php
/**
 * @author Jimmy Sole
 * @copyright (c) 2010 Jimmy Sole
 * @version 0.1 alpha
 * This program is free to use and/or modify. Please keep this header intact however. 
 */


/**
 * @author Jimmy Sole
 * @package pBlahDatabase
 */
final class pBlahDatabase 
{
	/**
	 * @var static $dbh holds the db connection handle
	 */
	private static $dbh;
	
	/**
	 * @var constant fetches the results as a associative array
	 */
	const FETCH_ASSOC = PDO::FETCH_ASSOC;
	
	/**
	 * @access public
	 * @param mixed $host
	 * @param mixed $user
	 * @param mixed $pass
	 * @param mixed $dbname
	 * @return pBlahDatabase
	 */
	public function __construct($host = "", $user = "", $pass = "", $dbname = "")
	{
		try {
			self::$dbh = new PDO("mysql:dbname=$dbname;host=$host", $user, $pass);
		} catch (PDOException $e) {
			echo $e->getMessage();
		}
	}
	
	/**
	 * @access public
	 * @param string $query
	 * @return boolean|PDOStatement
	 */
    public function query($query) 
    {
    	if (empty($query)) {
    		return false;
    	} 
      return self::$dbh->query($query);
    }
    
    
}